<div id="excel_output_id" style="display: none;">
    <div class="layui-form layui-form-pane" style="padding:1em;" id="excel_out">
        <div class="layui-form-item">
            <label class="layui-form-label">时间类型</label>
            <div class="layui-input-block">
                <input type="radio" name="excel_type" value="arrive_time" title="到诊" checked="checked" />
                <input type="radio" name="excel_type" value="order_time" title="预约" />
                <input type="radio" name="excel_type" value="createtime" title="录入" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-block">
                <input id="excel_start_time" type="text" value="<?= date('Y-m-d', strtotime('-1 day')) ?>" name="excel_start" required lay-verify="required" autocomplete="off" class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-block">
                <input id="excel_end_time" type="text" value="<?= date('Y-m-d', strtotime('-1 day')) ?>" name="excel_end" required lay-verify="required" autocomplete="off" class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item button">
            <button class="layui-btn" lay-submit lay-filter="formBeforeSubmit" onclick="window.excel_out()" style="width: 100%;">
                确 定
            </button>
        </div>
    </div>
</div>

<script type="text/javascript">
    window.setTimeout("init_excel_layer()", 500);

    function init_excel_layer() {
        window.excel_content_html = $('#excel_output_id').html();
        $('#excel_output_id').remove();
    }

    function excel() {
        layui.layer.open({
            type: 1,
            title: '导出EXCEL',
            content: window.excel_content_html
        });
        layui.laydate.render({
            min: '2018-01-01',
            elem: '#excel_start_time, #excel_end_time',
            isInitValue: true
        });
        return layui.form.render();
    }
    window.excel_out = function() {
        var excel_start_time = $('#excel_start_time').val();
        var excel_end_time = $('#excel_end_time').val();
        var excel_type = $('#excel_out input[name="excel_type"]:checked').val();
        var params_string = '&excel_start_time=' + excel_start_time;
        params_string += '&excel_end_time=' + excel_end_time;
        params_string += '&excel_type=' + excel_type;
        window.open('<?= yii\helpers\Url::toRoute('patient/excelout') ?>' + params_string);
    };
</script>